
function showOneButtonPopupDialog(tittle, message){
	$("#oneButtonPopupDialogTittle").text(tittle);
	$("#oneButtonPopupDialogMessage").text(message);	
	$("#oneButtonPopupDialog").popup('open');
}

function showPhotoInDiv(url,divId){
	var img = $("<img width='"+($(window).width()*30) /100 +"' height='"+($(window).height()*15) /100+"'/>").attr('src', url)
    .load(function() {
        if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
            alert('broken image!');
            //TODO enviar email con error
        } else {
        	$("#"+divId).html('');
            $("#"+divId).append(img);										                    
        }
    });
}

function manageStep(step,result,password,scringoId){
	switch (step) {
	case SHOW_USER_PROFILE_PHOTO:
		$("#profileUserPage").spin("modal");
		break;
	case STEP_UPDATE_USER_PROFILE_PHOTO:
		$("#profileUserPage").spin("modal");
		break;
	 
	case STEP_LOGIN:
		storage = {type: 0, email: result.email, password: password, scringoId: scringoId,qbUserId:result.id }; 
		localStorage['auth'] = $.base64.encode(JSON.stringify(storage));
		
		status = {status : $("#signUpUserPage").val()}
		localStorage['status'] = $.base64.encode(JSON.stringify(status));
		break;
	case STEP_INIT_APP:
	  	$("#signUpUserPage").spin("modal");
 //show list users
			break;		
	default:
		break;
	}
}